﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */


#region Using


#endregion

using System.Security.Cryptography;
using System.Text;
using System;
using NetBay.Core.Encryption;

namespace NetBay.Core.BusinessEntities
{
    public class MessageRequest
    {
        public string LicenseKey { get; set; }

        public MessageRequest()
        {
        }

        public MessageRequest(string licenseKey)
        {
            LicenseKey = licenseKey;
        }

        /// <summary>
        /// Inits the license.
        /// </summary>
        public void EncryptLicense()
        {
            LicenseKey = AesEncryption.Encrypt(string.Format("{0}${1}", LicenseKey, DateTime.Now.AddSeconds(10).ToString()));
        }

        /// <summary>
        /// Encrypts the license.
        /// </summary>
        /// <param name="duration">The duration.</param>
        public void EncryptLicense(int duration)
        {
            LicenseKey = AesEncryption.Encrypt(string.Format("{0}${1}", LicenseKey, DateTime.Now.AddSeconds(duration).ToString()));
        }
    }
}
